package com.wp.module.wpWallpaperList.controller;

import com.wp.common.annotation.Log;
import com.wp.common.core.controller.BaseController;
import com.wp.common.core.domain.AjaxResult;
import com.wp.common.core.page.TableDataInfo;
import com.wp.common.enums.BusinessType;
import com.wp.module.wpWallpaperList.domain.WpWallpaperList;
import com.wp.module.wpWallpaperList.service.IWpWallpaperListService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 壁纸列表Controller
 * 
 * @author wp
 * @date 2025-02-25
 */
@RestController
@RequestMapping("/module/wpWallpaperList")
public class WpWallpaperListController extends BaseController
{
    @Autowired
    private IWpWallpaperListService wpWallpaperListService;

    /**
     * 查询壁纸列表列表
     */
    @PreAuthorize("@ss.hasPermi('module:wpWallpaperList:list')")
    @GetMapping("/list")
    public TableDataInfo list(WpWallpaperList wpWallpaperList)
    {
        startPage();
        List<WpWallpaperList> list = wpWallpaperListService.selectWpWallpaperListList(wpWallpaperList);
        return getDataTable(list);
    }

    /**
     * 获取壁纸列表详细信息
     */
    @PreAuthorize("@ss.hasPermi('module:wpWallpaperList:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(wpWallpaperListService.selectWpWallpaperListById(id));
    }

    /**
     * 新增壁纸列表
     */
    @PreAuthorize("@ss.hasPermi('module:wpWallpaperList:add')")
    @Log(title = "壁纸列表", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody WpWallpaperList wpWallpaperList)
    {
        return toAjax(wpWallpaperListService.insertWpWallpaperList(wpWallpaperList));
    }

    /**
     * 修改壁纸列表
     */
    @PreAuthorize("@ss.hasPermi('module:wpWallpaperList:edit')")
    @Log(title = "壁纸列表", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody WpWallpaperList wpWallpaperList)
    {
        return toAjax(wpWallpaperListService.updateWpWallpaperList(wpWallpaperList));
    }

    /**
     * 删除壁纸列表
     */
    @PreAuthorize("@ss.hasPermi('module:wpWallpaperList:remove')")
    @Log(title = "壁纸列表", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(wpWallpaperListService.deleteWpWallpaperListByIds(ids));
    }

    /**
     * 上传壁纸
     */
    @PostMapping("/uploadImg")
    public AjaxResult uploadWp(){
        System.out.println("uploadWp");
        System.out.println();
        return success();
    }
}
